<?php use_helper('jQuery', 'Form'); ?>
<div style="min-height: 20px"><div id="feedback"></div><div id="indicator" style="display: none;"><?php echo image_tag("ajax-loading_2.gif", array("alt" => __("Čuva se"))) ?></div></div>


<?php
$glue = array("CasP", "Cas", "Cas1", "Cas2", "Cas3", "Cas4", "Cas5", "Cas6", "Cas7", "Cas8");
$glue_naziv = array("Predcas", "Nulti", "1. čas", "2. čas", "3. čas", "4. čas", "5. čas", "6. čas", "7. čas", "8. čas");
$i = 1;
foreach($raspored_arr as $rasporeds)
{?>
<table class="raspored_holder" style='margin-top:10px; clear:both;' border="1" cellpadding="0" cellspacing="0">
  <tr>
    <th style="width: 100px;" scope="col"><?php echo (($i++ > 1) ? 'Posle podne' : 'Pre podne') ?></th>
    <th scope="col">Ponedeljak</th>
    <th scope="col">Utorak</th>
    <th scope="col">Sreda</th>
    <th scope="col">Cetvrtak</th>
    <th scope="col">Petak</th>
    <th scope="col">Subota</th>
  </tr>

<?php
    $k = 0;
    while($k < 10)
    {?>
    <tr>
    <th scope="row"><?php echo $glue_naziv[$k] ?></th>
    <?php
      $j = 1;
      foreach($rasporeds as $dan)
      {
        echo "<td>".select_tag($glue[$k].'_'.$dan['Id'], options_for_select($predmets, $dan[$glue[$k]]), array("class" => "raspored_cas", "onchange" => jq_remote_function(array('form' => 'id=this.id', 'update' => 'feedback', 'url' => 'razred/changeRaspored?razred_id='.$sf_request->getParameter('razred_id'), 'loading'  => '$("#indicator").show();$("#feedback").hide()', 'complete' => '$("#indicator").hide();$("#feedback").show()'))))."</td>";
      }
      echo "</tr>";
      $k++;
    }

    echo "</table>";
}
?>